package com.chris.datacnter.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


@Controller
public class WebBaseContorller {
    Logger logger  = LoggerFactory.getLogger(this.getClass());

    /**
     * 系统默认404会跳到error
     * 注意这里有坑 如果使用了RestController则意味着返回了 ResponseBody，将不再有ModelAndView
     * 拦截的获取的 ModelAndView=null
     * @return
     */
    @GetMapping(value={"/error","/errorPage"})
    @ResponseBody
    public String error (HttpServletRequest request, HttpServletResponse response)  {
        return "--->404<---";
    }



    @GetMapping(value={"/test"})
    @ResponseBody
    public int test()
    {
        return  1/0;
    }



}
